﻿@{
    ViewBag.Title = "系统日志";
}
@section header{

}
<div class="topPanel">
    <div class="toolbar">

    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width: 200px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>

@section scripts{
    <script>
        var baseUrl = "/Sys/Syslog/";
        $(function () {
            gridList();
        })
        function gridList() {
            var $gridList = $("#gridList");
            $gridList.dataGrid({
                url: baseUrl + "GetJGridPageDataJson",
                datatype: "json",
                height: $(window).height() - 128,
                mtype: "POST",
                colModel: [
                    { label: "主键", name: "ID", hidden: true, key: true },
                    { label: '发布人', name: 'UserID', align: 'left' },
                    { label: '类型', name: 'Type', align: 'left' },
                    { label: 'IP地址', name: 'IPAddress', align: 'left' },
                    { label: '所在城市', name: 'IPAddressName', align: 'left' },
                    { label: '系统模块', name: 'ModuleId', align: 'left' },
                    { label: '结果', name: 'Result', align: 'left' },
                    { label: '描述', name: 'Description', align: 'left' },
                    {
                        label: '添加时间', name: 'AddTime', width: 120, align: 'left',
                        formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' }
                    }
                ],
                rowNum: 20,
                rowList: [20, 50, 100],
                pager: '#gridPager',
                sortname: 'OrderBy',
                sortorder: "asc",
                viewrecords: true,
                autowidth: true
            });
            $("#btn_search").click(function () {
                $gridList.jqGrid('setGridParam', {
                    postData: { keyword: $("#txt_keyword").val() },
                }).trigger('reloadGrid');
            });
        }
    </script>
}